Dynomotion

Group: DynoMotion Message: 13708 From: ju1ce89 Date: 8/23/2016
Subject: KMotionCNC M Code interpretation problem

Hi Tom,

I have been running a KFLOP board on my 4 axis milling machine for about 2 years now with great success. The closed-loop stepper configuration has taken my machine to new levels of performance!
I recently installed an encoder on my spindle in order to gain rigid tapping capability and wrote/modified a custom C program that I have currently set up as M100. I am fairly confident that my C program is set up properly, but I am running into the following issue: When I enter a M code reference (I have tried M100-119), The P, Q and R words are not recognized by KMotionCNC (ver. 4.33q). Only the P word changes color, but when I added the following code to the beginning of my C program in order to verify that each persist variable (i.e., the P, Q and R words) are read from my G code, the printed results in the console do not match my G code at all:


      printf("P = %f Q = %f R = %f\n",

            *(float *)&persist.UserData[0],

            *(float *)&persist.UserData[1],

            *(float *)&persist.UserData[2]);"


G Code: M100 P0.025 Q0.5 R1


Console Output: P = 0.000000 Q = 0.000000 R = 1.500000


Please let me know what I can do/try to solve this issue. I think that once I can get the M Code input to be passed on to my C program, I can quickly get rigid tapping to work.

Thank you so much for your help,

Julius

 

Group: DynoMotion Message: 13709 From: Tom Kerekes Date: 8/23/2016
Subject: Re: KMotionCNC M Code interpretation problem

Hi Julius,

It seems to work for me in V4.33q I get:

P = 0.025000 Q = 0.500000 R = 1.000000

Do you have the Var Setting for the M100 set to 0 ?

Regards

TK

On 8/23/2016 7:08 AM, julius.schoop@... [DynoMotion] wrote:
 

Hi Tom,

I have been running a KFLOP board on my 4 axis milling machine for about 2 years now with great success. The closed-loop stepper configuration has taken my machine to new levels of performance!
I recently installed an encoder on my spindle in order to gain rigid tapping capability and wrote/modified a custom C program that I have currently set up as M100. I am fairly confident that my C program is set up properly, but I am running into the following issue: When I enter a M code reference (I have tried M100-119), The P, Q and R words are not recognized by KMotionCNC (ver. 4.33q). Only the P word changes color, but when I added the following code to the beginning of my C program in order to verify that each persist variable (i.e., the P, Q and R words) are read from my G code, the printed results in the console do not match my G code at all:


      printf("P = %f Q = %f R = %f\n",

            *(float *)&persist.UserData[0],

            *(float *)&persist.UserData[1],

            *(float *)&persist.UserData[2]);"


G Code: M100 P0.025 Q0.5 R1


Console Output: P = 0.000000 Q = 0.000000 R = 1.500000


Please let me know what I can do/try to solve this issue. I think that once I can get the M Code input to be passed on to my C program, I can quickly get rigid tapping to work.

Thank you so much for your help,

Julius

 


Group: DynoMotion Message: 13710 From: ju1ce89 Date: 8/23/2016
Subject: Re: KMotionCNC M Code interpretation problem
Tom,

You identified my problem right away! I had the VAR for M100 set to 113 (since my program uses KMVAR), but of course that means that the variables from M100 will be 113-5. I will set the VAR to 0 so that I get P, Q, R as 0, 1, 2. 

Thank you!

Julius